function delRel (id) {
    $.ajax({
         type: "DELETE",
         url: "/api/trans/rel/del/"+id,
         data: {},
         dataType: "json",
         success: function(data){
            if(data.code =='200'){
                 window.location.reload();
            }
         }
    });
}
function changeRel (id) {
    $.ajax({
         type: "GET",
         url: "/api/trans/rel/"+id,
         data: {},
         dataType: "json",
         success: function(data){
            if(data.code =='200'){
                var obj = eval(data.data);
                $("#input_id").val(obj.id);
                $("#catalog_sno").val(obj.catalog_sno);
                $("#trans_sno").val(obj.trans_sno);
                $("#trans_sno_view").val(obj.trans_name);
                $("#catalog_sno_view").val(obj.catalog_name);
                $("#catalogSelect").val(obj.catalog_sno);
                $("#transSelect").val(obj.trans_sno);
            }
         }
    });
}
function editRel () {
    var id = $("#input_id").val();
    $.ajax({
        type: "PUT",
        url: "/api/trans/rel/update/"+id,
        data: {
            catalog_sno:$("#catalog_sno").val(),
            trans_sno:$("#trans_sno").val()
        },
        dataType: "json",
        success: function(data){
            if(data.code =='200'){
                window.location.reload();
            }
        }
    });
}
function chooseCatalog(){
    let val = $("#catalogSelect").val();
    let label = $("#catalogSelect").find("option:selected").text();
    $("#catalog_sno").val(val);
    $("#catalog_sno_view").val(label);
}
function chooseTrans(){
    let val = $("#transSelect").val();
    let label = $("#transSelect").find("option:selected").text();
    $("#trans_sno").val(val);
    $("#trans_sno_view").val(label);
}